package com.poh.Utils;

import java.time.LocalDate;
import java.time.LocalTime;

public class Timer {
    public static int judegeTime(String satrtTime, int time) {
        LocalDate localDate = LocalDate.now();
        LocalTime localTime = LocalTime.now();
        String nowDay = localDate.toString().substring(8, 10);
        String nowHour = localTime.toString().substring(0, 2);
        String nowMin = localTime.toString().substring(3, 5);
        String day = satrtTime.substring(8,10);
        String hour = satrtTime.substring(11,13);
        String min = satrtTime.substring(14, 16);
        if (day.equals(nowDay)) {
            if (hour.equals(nowHour)) {
                if (Integer.parseInt(min) + time >= Integer.parseInt(nowMin)) { // 4点 2
                    return 1;
                } else if (Integer.parseInt(min) + time >= Integer.parseInt(nowMin)) {
                    return 2;
                } else {
                    return 2;
                }
            } else {
                return 2;
            }
        } else {
            return 2;
        }
    }


}
